package com.goodving.guli.utility;

import android.app.Activity;
import android.support.v4.view.PagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.GridView;

import com.goodving.guli.R;
import com.goodving.guli.activity.MainFragmentActivity;
import com.goodving.guli.fragment.CalendarDailyFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2015-11-17.
 */
public class aa extends PagerAdapter {
//    public List<C1041e> f3717a;
    private ArrayList<DailyInfoContainer> f3718b;
    private Activity f3719c;
    private CalendarDailyFragment f3720d;
    private List<View> f3721e;

    /* renamed from: cn.ledongli.ldl.a.aa.a */
    public class C1034a implements AdapterView.OnItemClickListener {
        final /* synthetic */ aa f3716a;

        public C1034a(aa aaVar) {
            this.f3716a = aaVar;
        }

        public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
            ((MainFragmentActivity) this.f3716a.f3719c).f4030u = ((CalenderData) ((DailyInfoContainer) this.f3716a.f3718b.get(this.f3716a.f3720d.mCurrentPosition)).getDailyInfoList().get(i)).f6087c;
//            ((MainFragmentActivity) this.f3716a.f3719c).m7827r();
        }
    }

    public aa(Activity activity, CalendarDailyFragment calendarDailyFragment, ArrayList<DailyInfoContainer> arrayList) {
        this.f3718b = new ArrayList();
        this.f3721e = new ArrayList();
//        this.f3717a = new ArrayList();
        this.f3719c = activity;
        this.f3720d = calendarDailyFragment;
        this.f3718b = arrayList;
        m7583a();
    }

    private void m7583a() {
        for (int i = 0; i < this.f3718b.size(); i++) {
            View inflate = LayoutInflater.from(this.f3719c).inflate(R.layout.viewpager_month_daily, null);
            GridView gridView = (GridView) inflate.findViewById(R.id.gv_calendar);
//            ListAdapter c1041e = new C1041e(this.f3719c, (DailyInfoContainer) this.f3718b.get(i), ((MainFragmentActivity) this.f3719c).f4030u);
//            this.f3717a.add(c1041e);
//            gridView.setAdapter(c1041e);
            gridView.setOnItemClickListener(new C1034a(this));
            this.f3721e.add(inflate);
        }
    }

    public int getCount() {
        if (this.f3721e == null || this.f3721e.size() <= 0) {
            return 0;
        }
        return this.f3721e.size();
    }

    public boolean isViewFromObject(View view, Object obj) {
        return view == obj;
    }

    public void destroyItem(ViewGroup viewGroup, int i, Object obj) {
        viewGroup.removeView((View) obj);
    }

    public Object instantiateItem(ViewGroup viewGroup, int i) {
        viewGroup.addView((View) this.f3721e.get(i));
        return this.f3721e.get(i);
    }

    public int getItemPosition(Object obj) {
        return -2;
    }
}
